﻿using System.Collections.Generic;
using System.Data;
using System;
using SXT.Party.WomenAndChildrens.Model;
using SXT.Party.Utility;
namespace ZHDJ.MobileInterface
{
    public partial class GetPartyWCDoctorDetail : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            WCDoctorDetailOutParam result = new WCDoctorDetailOutParam();
            WCDoctorDetailInParam param = new WCDoctorDetailInParam();
            string logMsg = "";
            bool isFlag = true;


            try
            {
                param = inParam as WCDoctorDetailInParam;

                if (string.IsNullOrEmpty(param.ExpertsID))
                {
                    result.code = "0";
                    result.desc = "专家ID不能为空。";

                    isFlag = false;
                }
                if (isFlag)
                {
                    DataSet ds = new DataSet();
                    ds = PartyWCExperts.GetGridData("", 1, 10, param.ExpertsID, null, "true");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        result.ExpertsID = ds.Tables[0].Rows[0]["ExpertsID"].ToString();
                        result.ExpertName = ds.Tables[0].Rows[0]["ExpertName"].ToString();
                        result.ExpertsID = ds.Tables[0].Rows[0]["ExpertsID"].ToString();
                        result.lofty = ds.Tables[0].Rows[0]["lofty"].ToString();
                        result.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                        result.Url = ds.Tables[0].Rows[0]["Url"].ToString();
                        result.InterlocutionCount = ds.Tables[0].Rows[0]["InterlocutionCount"].ToString();
                        result.DianzanCount = ds.Tables[0].Rows[0]["DianzanCount"].ToString();

                        if (!string.IsNullOrEmpty(result.Url))
                            result.Url = CommonUtils.AppAddress + PageUtility.GetImageUrl(result.Url, "_small");
                        else
                        {
                            result.Url = CommonUtils.AppAddress + "Resource/themes/default/images/Party/Party-Emblem.jpg";
                        }
                    }
                }
                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员";
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode + "-GetPartyWCDoctorDetail", SerializeHelper.JsonSerializer<WCDoctorDetailInParam>(param), logMsg);
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<WCDoctorDetailInParam, WCDoctorDetailOutParam>();
            else
                SafeProcessRequest<WCDoctorDetailInParam, WCDoctorDetailOutParam>();
        }
    }

    #region 请求参数
    public class WCDoctorDetailInParam
    {
        /// <summary>
        /// 专家ID
        /// </summary>
        public string ExpertsID
        { get; set; }
        /// <summary>
        /// 资询人
        /// </summary>
        public string LoginID
        { get; set; }
    }
    #endregion

    #region 结果参数
    public class WCDoctorDetailOutParam
    {
        public WCDoctorDetailOutParam()
        {
            code = "1";
            desc = "操作成功";
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        /// <summary>
        ///	专家ID		
        /// </summary>
        public string ExpertsID
        { get; set; }

        /// <summary>
        ///	专家姓名			
        /// </summary>
        public string ExpertName
        { get; set; }

        /// <summary>
        ///	专家头衔		
        /// </summary>
        public string lofty
        { get; set; }

        /// <summary>
        ///	擅长			
        /// </summary>
        public string Talent
        { get; set; }

        /// <summary>
        ///	个人介绍			
        /// </summary>
        public string Remark
        { get; set; }

        /// <summary>
        ///	图片地址			
        /// </summary>
        public string Url
        { get; set; }

        /// <summary>
        ///	咨询数			
        /// </summary>
        public string InterlocutionCount
        { get; set; }

        /// <summary>
        ///	点赞数			
        /// </summary>
        public string DianzanCount
        { get; set; }
    }

    #endregion
}